<?php
ob_start();
require_once '../sub/init.php';
require_once 'chkUadm.php';
if(!in_array('tx',$QXARR))exit(noauth());
require_once ZEAI.'cache/udata.php';
$nav='index';
require_once ZEAI.'m/div_left_so.php';?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $_ADM['admSiteName']; ?></title>
<?php echo HEADMETA; ?>
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<?php require_once 'm_style.php';?>
<link href="css/m_adm.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
.ZEAI_list{padding:100px 0 80px;width:92%;margin:0 auto}
.ZEAI_list dl{width:100%;margin:0 auto 20px auto;border-radius:8px;background-color:#fff;box-shadow:0 0 28px rgb(0 0 0 / 8%);position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;position:relative;padding-bottom:10px}
.ZEAI_list dl .tbody{padding:0 10px;margin:0 auto 10px auto;line-height:40px;color:#999;border-bottom:#f5f5f5 1px solid;text-align:left}
.ZEAI_list dl .tbody{font-size:12px;text-align:left;color:#999}
.ZEAI_list dl .tbody b,.ZEAI_list dl .tbody span{display:inline-block;color:#333;font-weight:normal;vertical-align:middle}
.ZEAI_list dl .tbody span{color:#999}
.ZEAI_list dl .tbody .flagbox{float:right;font-size:12px}
.ZEAI_list dl .tbody .flag0{color:#f00}
.ZEAI_list dl .tbody .flag1{color:#090}
.ZEAI_list dl dt,.ZEAI_list dl dd{float:left;display:block;padding:10px 0 10px}
.ZEAI_list dl dt{width:50px;padding-left:10px;font-size:14px;text-align:left;line-height:150%}
.ZEAI_list dl dt img.photo_s{width:40px;height:40px;object-fit:cover;-webkit-object-fit:cover;border-radius:50%}
.ZEAI_list dl dd{width:-webkit-calc(100% - 90px);text-align:left}
.ZEAI_list dl dd h6{margin-top:4px}
.ZEAI_list dl dd h6 b{color:#f00;font-weight:normal}
.ZEAI_list dl dd h6 font{color:#ccc;margin:0 10px}
.ZEAI_list dl .flag_ico_wait{width:70px;height:70px;position:absolute;;right:10px;top:100px}
.ZEAI_list dl .btn{position:absolute;right:12px;z-index:1}
.ZEAI_list dl .auto{top:50px;background-color:<?php echo $_ADM['color'];?>}
.ZEAI_list dl .hand{top:92px;background-color:#F07A70}
.ZEAI_list dl .pass{top:134px;background-color:#999}
.ZEAI_list dl .datali{margin-top:5px;padding:0 10px 10px;text-align:left;font-size:12px;position:relative}
.ZEAI_list dl .datali h5{width:85%;font-size:12px;color:#999}
.ZEAI_list dl .datali h6{width:85%;margin-top:7px}
#backtop{z-index:2}
</style>
</head>
<body>
<?php
$SQL = "AND a.kind=-1";
if($f=='f0')$SQL .= " AND a.flag=0 ";
$Skey = trimhtml($Skey);
switch ($sort) {
	default:$SORT = " ORDER BY a.id DESC ";break;
}
if($t=='tg'){
	$SQL1 .= " AND tg_uid<>''";
	if (ifint($Skey)){
		$SQL1 .= " AND a.tg_uid=$Skey ";
	}elseif(ifmob($Skey)){
		$SQL1 .= " AND b.mob=$Skey ";
	}elseif(!empty($Skey)){
		$SQL1 .= " AND ( b.uname LIKE '%".$Skey."%' )";
	}
	$placeholder='按推广员ID/用户名';
}else{
	if (ifint($Skey)){
		$SQL2 .= " AND (a.uid=$Skey) ";
	}elseif(!empty($Skey)){
		$SQL2 .= " AND ( ( b.uname LIKE '%".$Skey."%' ) OR ( b.nickname LIKE '%".$Skey."%' ) OR ( b.nickname LIKE '%".urlencode($Skey)."%' ) )";
	}
	$placeholder='按UID/用户名/昵称';
}
$rt2 = $db->query("SELECT a.*,b.sex,b.grade,b.nickname,b.flag AS uflag,b.photo_s FROM ".__TBL_PAY__." a,".__TBL_USER__." b WHERE a.uid=b.id  ".$SQL.$SQL2.$SORT." LIMIT ".$_ADM['admLimit']);
$total2 = $db->num_rows($rt2);

$rt1 = $db->query("SELECT a.*,b.grade,b.uname,b.flag AS uflag,b.title,b.photo_s FROM ".__TBL_PAY__." a,".__TBL_TG_USER__." b WHERE a.tg_uid=b.id  ".$SQL.$SQL1.$SORT." LIMIT ".$_ADM['admLimit']);
$total1 = $db->num_rows($rt1);

if($t=='tg'){
	$rt = $rt1;
	$total = $total1;
}else{
	$rt = $rt2;
	$total = $total2;
}
//
$mini_title='提现管理';$mini_class='top_mini4 ';
$mini_L = '<em onClick="zeai.openurl(\'m_adm.php\')"><i class="ico" >&#xeaca;</i><span></span></em>';
require_once ZEAI.'m/top_mini.php';?>
<a class="so" id="user_search"><i class="ico">&#xe66c;</i><span>筛选</span></a>
<div class="tabmenu tabmenu2 tabmenufix">
	<a href="m_withdraw.php"<?php echo (empty($t))?' class="ed"':'';?>>单身用户(<?php echo $total2;?>)</a>
	<a href="m_withdraw.php?t=tg"<?php echo ($t=='tg')?' class="ed"':'';?>>推广员/商家(<?php echo $total1;?>)</a>
</div>
<form id="www_zeai_cn_FORM" class="ZEAI_list" method="get" action="<?php echo SELF; ?>">
	<?php
	if ($total <= 0 ) {
		echo "<div class='nodataico'><i class='ico'>&#xe608;</i>暂无信息<br><br><a class='aBAI' href='javascript:history.back(-1)'>返回上一步</a></div>";
	} else {
		$page_skin=2;$pagemode='mob';$pagesize=8;require_once ZEAI.'sub/page.php';
		for($i=1;$i<=$pagesize;$i++) {
			$rows = $db->fetch_array($rt,'name');if(!$rows) break;
			$id = $rows['id'];$uid = $rows['uid'];$tg_uid = $rows['tg_uid'];
			$uname = strip_tags($rows['uname']);
			$uname = str_replace($Skey,"<font color=red><b>".$Skey."</b></font>",$uname);
			$nickname = trimhtml(dataIO($rows['nickname'],'out'));
			if(empty($nickname))$nickname = $uname;
			$nickname  = str_replace($Skey,"<font color=red><b>".$Skey."</b></font>",$nickname);
			$sex       = $rows['sex'];
			$grade     = $rows['grade'];
			$uflag     = $rows['uflag'];
			$photo_s   = $rows['photo_s'];
			//申请提现相关字段
			$money = $rows['money'];
			$paymoney = $rows['paymoney'];
			$trade_no  = $rows['trade_no'];
			$money_list_id = $rows['money_list_id'];
			$addtime = YmdHis($rows['addtime']);
			$paytime = YmdHis($rows['paytime']);;
			$flag = $rows['flag'];
			$title = trimhtml(dataIO($rows['title'],'out'));
			if($t=='tg'){
				$uid=$tg_uid;
				$title = dataIO($rows['title'],'out');
				$nickname = (!empty($title))?$title:$nickname;
				$photo_s_url = (!empty($photo_s))?UP.$photo_s:RES.'noP.gif';
			}else{
				$photo_s_url = (!empty($photo_s))?UP.smb($photo_s,'s'):RES.'photo_s'.$sex.'.png';
			}
			$flag_str = '';$tgbtn_str = '';$flag_ico_str = '';
			switch ($flag) {
				case 0:
					$flag_str = "<i class='ico'>&#xe65b; 未打款</i>";
					$flag_cls = ' flag0';
					$tgbtn_str  = '<a value="'.$id.'" nickname="'.$nickname.'" class="btn size2 auto" style="margin-top:5px">自动</a>';
					$tgbtn_str .= '<a value="'.$id.'" nickname="'.$nickname.'" class="btn size2 hand" style="margin-top:5px">手动</a>';
					$tgbtn_str .= '<a value="'.$id.'" class="btn size2 pass" style="margin-top:5px">驳回</a>';
					$flag_ico_str = '';
				break;
				case 1:$flag_str = "<i class='ico'>&#xe67f; 已打款</i>";$flag_cls= ' flag1';$flag_ico_str = '<img class="flag_ico_wait" src="images/flag_dkcg.png">';break;
			}?>
            <dl>
            	<div class="tbody">
                    <?php
                    if($t=='tg'){
                        echo '<b>'.$tg_uid."</b><span>（".$nickname."）</span>";
                    }else{
                        echo uicon($sex.$grade).'<b>'.$uid."</b><span>（".$nickname."）</span>";
                    }?>                    
                    <div class="flagbox<?php echo $flag_cls;?>"><?php echo $flag_str;?></div>
				</div>
                <dt><a href="javascript:ZeaiM.piczoom('<?php echo smb($photo_s_url,'b');?>');"><img class="photo_s" src="<?php echo $photo_s_url;?>"></a></dt>
                <dd>
                	<h5><?php echo $title;?></h5>
					<h6>提现￥<?php echo $money;?><font>|</font>实际打款<b>￥<?php echo $paymoney;?></b></h6>
                </dd>
                <?php echo $tgbtn_str.$flag_ico_str;?>
                <div class="clear"></div>
				<div class="datali">
                	<h5><?php echo '申请时间：'.$addtime;?></h5>
                	<h6>打款时间：<?php if($flag==1){echo $paytime;}else{echo'未打款';}?></h6>
                </div>
            </dl>
			<?php
		}
	}?>
</form>
<script>var bg = '<?php echo $_Style['list_bg']; ?>',overbg   = '<?php echo $_Style['list_overbg']; ?>',selectbg = '<?php echo $_Style['list_selectbg']; ?>';</script>
<!--div_left_so-->
<div id="rangebox"></div>
<div class="div_left_so" id="user_so">
	<form action="<?php echo SELF;?>" method="get" name="www.yzlove.com" id="ZEAI_CN_FORM_ext">
    	<div class="form_uid">
        <input name="Skey" type="text" class="input" id="Skey" maxlength="20" value="<?php echo $Skey;?>" placeholder="<?php echo $placeholder;?>" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
        <script>div_left_so_init('user_so')</script>
        <div class="savebox"><button type="button" class="btn size3 reset" onClick="div_left_so_reset('user_so',['t'])">重置</button><button type="submit" class="btn size3 zeaibg ico">&#xe6c4; 确定</button></div>
        <input type="hidden" name="t" id="t" value="<?php echo $t;?>">
    </form>
</div>
<script>user_search.onclick=function(){ZeaiM.div_left({obj:user_so,w:28});}</script>
<!--div_left_so end-->
<?php if ($total > $pagesize ) {?>
    <?php echo $page_cls;?>
    <div class="listbottombox" style="text-align:center">
        <?php if ($total > $pagesize)echo '<div class="pagebox" style="float:initial">'.$pagelist.'</div>'; ?>
    </div>
<?php }?>
<?php if ($total > 0 ) {?>
<div id="backtop"><a id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<script>
document.body.onscroll = backtop_alone;
zeai.listEach('.auto',function(obj){
	obj.onclick = function(){
		var id = parseInt(obj.getAttribute("value")),nickname = obj.getAttribute("nickname");
		zeai.iframe('向【'+nickname+'】打款','<?php echo ($t=='tg')?'tg_u_money_withdraw':'u_money_withdraw';?>'+zeai.ajxext+'id='+id,320,430)
	}
});
zeai.listEach('.hand',function(obj){
	obj.onclick = function(){
		var id = parseInt(obj.getAttribute("value")),nickname = obj.getAttribute("nickname");
		zeai.iframe('向【'+nickname+'】打款','withdraw'+zeai.ajxext+'submitok=tx_hand&id='+id,320,430)
	}
});
zeai.listEach('.pass',function(obj){
	obj.onclick = function(){
		var id = parseInt(obj.getAttribute("value"));
		zeai.confirm('确定要驳回此提现申请吗？<br>驳回后提现金额将会退回到该用户余额账户。',function(){
		zeai.ajax('withdraw'+zeai.ajxext+'submitok=ajax_delupdate&t=<?php echo $t;?>&id='+id,function(e){var rs=zeai.jsoneval(e);
			if (rs.flag == 1){location.reload(true);}else{zeai.msg(rs.msg);}
		});});
	}
});
</script>
<?php }?>
</body></html><?php ob_end_flush();?>